<?php
include_once "../classes/chuyenmuc_bs.php";

if(isset($_GET['dmid'])){
    $dmid = $_GET['dmid'];
    $selectBox2  = '';
    $chuyenmuc = new chuyenmuc_bs();
	$chuyenmuc->SetMaTrangThai(1);
	$chuyenmuc->SetMaChuDe($dmid);
	$data_chuyenmuc = $chuyenmuc->LayDanhSach();
    if($dmid != 0)
	{   
        $selectBox2 .= '<select name="MaChuyenMuc">';
        $selectBox2 .= '<option value="noselect" selected>-- Chọn chuyên mục --</option>';
        for($i = 0; $i < count($data_chuyenmuc); $i++)
		{   
            $selectBox2 .= '<option value="'.$data_chuyenmuc[$i]['MaChuyenMuc'].'">'.$data_chuyenmuc[$i]['TenChuyenMuc'].'</option>';
        }
        $selectBox2 .= '</select>';    
    }
    else{
        $selectBox2 .= '<select name="MaChuyenMuc">';
        $selectBox2 .= '    <option>-- Chọn chuyên mục --</option>';
        $selectBox2 .= '</select>';
    }
    
    echo $selectBox2;    
}
?>